import request from '../utils/request';

/**
 * 我的兑换卡里的激活卡
 * @param {int} page 页数
 * @param {int} page_number 页脚
 */
export function getActiveList(data) {
  return request({
    url: 'shop-card/active-lists',
    method: 'post',
    data: data
  });
}

/**
 * 我的兑换卡里的申领卡列表
 * @param {int} page 页数
 * @param {int} page_number 页脚
 * @param {int} start_time
 * @param {int} end_time
 * @param {int} status
 */
export function getApplyRecordList(data) {
  return request({
    url: 'shop-card/apply-lists',
    method: 'post',
    data: data
  });
}

/**
 * 申领卡记录
 * @param {int} page 页数
 * @param {int} page_number 页脚
 */
export function getApplyList(data) {
  return request({
    url: 'card-record/lists',
    method: 'post',
    data: data
  });
}


/**
 * 发起购物卡的申领
 * @param {int} type 购物卡类型
 * @param {string} nickname 申领人的昵称
 * @param {string} address 详情地址
 * @param {string} city 城市编码
 * @param {string} city_name 城市名称
 * @param {string} region 区域编码
 * @param {string} region_name 区域名称
 * @param {string} province 省市编码
 * @param {string} province_name 省市名称
 * @param {string} mobile 电话
 * @param {string} number 申领数量
 */
export function careteApply(data) {
  return request({
    url: 'card-record/create',
    method: 'post',
    data: data
  });
}

/**
 * 购物卡的类型
 */
export function getCardType() {
  return request({
    url: 'card/type',
    method: 'get',
  });
}

/**
 * 兑换卡列表
 * page page_number status start_time end_time
 */
export function exchangeCardList(data) {
  return request({
    url: 'shop-card/exchange-lists',
    method: 'post',
    data
  });
}


/**
 * 兑换卡列表
 * page page_number
 */
export function exchangedCardList(data) {
  return request({
    url: 'shop-card/exchanged-lists',
    method: 'post',
    data
  });
}
export function memberCardList(data) {
  return request({
    url: '/member-card-active/lists',
    method: 'get',
    data
  });
}
export function agentList(data) {
  return request({
    url: '/user/lists',
    method: 'get',
    data
  });
}
export function editagentList(data) {
  return request({
    url: '/user/edit-card-level-info',
    method: 'post',
    data
  });
}
export function turnoveCardList(data) {
  return request({
    url: '/member-card-use/lists',
    method: 'get',
    data
  });
}

/**
 * 申领卡记录到货
 * id
 */
export function cardArrive(data) {
  return request({
    url: 'card-record/arrive',
    method: 'post',
    data
  });
}


/**
 * 兑换
 * no
 */
export function cardConvert(data) {
  return request({
    url: 'shop-card/convert',
    method: 'post',
    data
  });
}
//绑定会员卡
export function cardMember(data) {
  return request({
    url: 'member-card/bind',
    method: 'post',
    data
  });
}
//新绑定会员卡
export function newcardMember(data) {
  return request({
    url: 'member-card/bind-new',
    method: 'post',
    data
  });
}
/**
 * 激活卡 从代理
 * card_no pay_type 1 wx 2 zfb pay_platform 1 xcx 2 h5
 */
export function activeCard(data) {
  return request({
    url: 'shop-card/activate',
    method: 'post',
    data
  });
}

/**
 * 二级代理从一级代理拿卡
 * card_no pay_type 1 wx 2 zfb pay_platform 1 xcx 2 h5
 */
export function addCard(data) {
  return request({
    url: 'shop-card/add-card',
    method: 'post',
    data
  });
}

/**
 * 购物卡出入库的记录
 * nickname type 0 出库 1 入库 card_type类型名 page page_number
 */
export function storageRecord(data) {
  return request({
    url: 'card-out-put-log/lists',
    method: 'post',
    data
  });
}

/**
 * 优惠券兑换
 * no
 */
export function couponConvert(data) {
  return request({
    url: 'coupon/exchange-no',
    method: 'post',
    data
  });
}
